package Aaaaaa;

import java.util.*;
/*
3
5 8 9
4 12 6
 */
public class Main11 {
    static List<int[]> res=null;
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int[] A=new int[n];
        int[] B=new int[n];
        for(int i=0;i<n;i++){
            A[i]=yinZi(sc.nextInt());
        }
        for(int i=0;i<n;i++){
            B[i]=yinZi(sc.nextInt());
        }
        System.out.println(Arrays.toString(A));
        System.out.println(Arrays.toString(B));
        res=new ArrayList<>();
        dfs(A,0);
        int max=0;
        for(int i=0;i<res.size();i++){
            int[] temp=res.get(i);
            System.out.println(Arrays.toString(temp));
            max=Math.max(max,count(temp,B));
        }
        System.out.println(max);
    }

    private static int count(int[] temp, int[] a) {
        int count=0;
        for(int i=0;i<temp.length;i++){
            if(temp[i]>a[i]){
                count++;
            }
        }
        return count;
    }

    private static void dfs(int[] b,int index) {
        if(index==b.length-1){
            int[] temp=new int[b.length];
            for(int i=0;i<temp.length;i++){
                temp[i]=b[i];
            }
            res.add(temp);
        }
        for(int i=index;i<b.length;i++){
            swap(b,i,index);
            dfs(b,index+1);
            swap(b,i,index);
        }
    }

    private static void swap(int[] b, int i, int index) {
        int temp=b[i];
        b[i]=b[index];
        b[index]=temp;

    }

    private static int yinZi(int n) {
        int count=0;
        for(int i=1;i*i<=n;i++){
            if(n%i==0){
                count+=2;
                if(n/i==i){
                    count--;
                }
            }
        }
        return count;
    }
}
